package com.apptest.android.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.ImageView;
import com.apptest.android.R;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;

public class ImageLoader {
    @SuppressLint("CheckResult")
    public static void load(Context context, String url, ImageView iv) {
        RequestOptions requestOptions = new RequestOptions();
        requestOptions.placeholder(R.drawable.bg_placeholder);
        Glide.with(context)
                .load(url)
                .apply(requestOptions)
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(iv);
    }
}
